package com.tinyspot.concrete.starter.controller;

import com.tinyspot.concrete.starter.business.BatchCommonBizProcessor;
import com.tinyspot.concrete.starter.business.CommonBizProcessor;
import com.tinyspot.concrete.starter.business.model.BatchOrderContext;
import com.tinyspot.concrete.starter.business.model.OrderContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Tinyspot
 * @date 2023-01-07 22:59
 */
@RestController
public class ProcessorController {

    @Resource
    private CommonBizProcessor orderCommonProcessor;
    @Resource
    private BatchCommonBizProcessor userBatchCommonProcessor;

    @RequestMapping("/processor")
    public String processor() {
        OrderContext orderContext = new OrderContext();
        orderCommonProcessor.execute(orderContext);
        return "success";
    }


    @RequestMapping("/batch/processor")
    public String batchProcessor() {
        BatchOrderContext batchOrderContext = new BatchOrderContext();
        userBatchCommonProcessor.execute(batchOrderContext);
        return "success";
    }
}
